package com.medisign.sign.log.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "sys")
public class SystemConfig {

    @Getter
    @Setter
    private Path path = new Path();

    @Getter
    @Setter
    private Sign sign = new Sign();

    @Getter
    @Setter
    private Query query = new Query();

    @Getter
    @Setter
    private DataSourceInfo dataSourceInfo = new DataSourceInfo();

    @Getter
    @Setter
    public static class Query {

        private int days = 3;
    }

    @Getter
    @Setter
    public static class DataSourceInfo {

        private String driverClassName = "com.mysql.jdbc.Driver";

        private String url;

        private String username;

        private String password;

    }

    @Getter
    @Setter
    public static class Sign {

        private String appid;

        private String appkey;

        private String host;

        private String userId;

        private int pageSize = 100;

        private int fileSizeLimit = 10000;

        private int redisSizeLimit = 1000;
    }

    @Getter
    @Setter
    public static class Path {

        private String base;

        private String signFile;

        private String signLog;

        public String getSignFilePath() {
            return this.base + this.signFile;
        }

        public String getSignLogPath() {
            return this.base + this.signLog;
        }
    }

}
